#include"seg.h"
#include"drv_spi2.h"
#include"drv_systick.h"
#include"drv_tim4.h"
//PB15   MOSI
//PB14	 MISO
//PB13	 SCLK
//PB12	 NSS
//| 数字 | 段码 (Hex) | 二进制 (a b c d e f g dp) |
//| -- | -------- | ---------------------- |
//| 0  | 0x3F     | 0 0 1 1 1 1 1 1        |
//| 1  | 0x06     | 0 0 0 0 0 1 1 0        |
//| 2  | 0x5B     | 0 1 0 1 1 0 1 1        |
//| 3  | 0x4F     | 0 1 0 0 1 1 1 1        |
//| 4  | 0x66     | 0 1 1 0 0 1 1 0        |
//| 5  | 0x6D     | 0 1 1 0 1 1 0 1        |
//| 6  | 0x7D     | 0 1 1 1 1 1 0 1        |
//| 7  | 0x07     | 0 0 0 0 0 1 1 1        |
//| 8  | 0x7F     | 0 1 1 1 1 1 1 1        |
//| 9  | 0x6F     | 0 1 1 0 1 1 1 1        |
uint8_t duanma[10]={
0x3F,0x06,0x5B,0x4F,0x66,
0x6D,0x7D,0x07,0x7F,0x6F};
uint8_t weima[4]={
0x01,0x02,0x04,0x08};
uint8_t duanma_1[10]={
0xBF,0x86,0xDB,0xCF,0xE6,
0xED,0xFD,0x87,0xFF,0xEF
};
void init_seg()
{

	init_spi2();
}
void seg_senddate(uint8_t n1,uint8_t n2)
{
	
	
	spi2_senddate(weima[n1]);
	spi2_senddate(duanma[n2]);
	GPIO_ResetBits(GPIOB,GPIO_Pin_12);
		tim4_delay_ms(1);
	GPIO_SetBits(GPIOB,GPIO_Pin_12);

	
}
void seg_senddate_dian(uint8_t n1,uint8_t n2)
{
	
	
	spi2_senddate(weima[n1]);
	spi2_senddate(duanma_1[n2]);
	GPIO_ResetBits(GPIOB,GPIO_Pin_12);
		tim4_delay_ms(1);
	GPIO_SetBits(GPIOB,GPIO_Pin_12);

	
}


